#!/bin/sh

##
# ProTec Server
##

. /etc/rc.common

StartService ()
{
	if [ -e /Library/StartupItems/ProTecVb ]
	then
		/Library/StartupItems/ProTecVb/ProTecVb stop

		mv /Library/StartupItems/ProTecVb/ProTecVb  /Library/StartupItems/ProTecVb/obsolete.ProTecVb 
		mv /Library/StartupItems/ProTecVb/NalpeirondVb /Library/StartupItems/ProTecVb/obsolete.NalpeirondVb
		mv /Library/StartupItems/ProTecVb/StartupParameters.plist /Library/StartupItems/ProTecVb/obsolete.StartupParameters.plist
	fi
		
	echo "Starting ProTec6 Server"
	/Library/StartupItems/ProTec6/Nalpeirond6 &
}

StopService ()
{
	echo "Stopping ProTecV Server"
	killall -INT Nalpeirond6 > /dev/null 2>&1
}

RestartService ()
{
    StopService
    StartService
}

RunService "$1"
